<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>课程信息系统</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="assets/css/admin.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <link rel="stylesheet" href="assets/css/pagination.css">
    <script src="assets/js/echarts.min.js"></script>
    <style>
    [class*=am-u-]+[class*=am-u-]:last-child {
        float: left;
    }
    .selector{                    /*将<a></a>相对定位*/
        position:relative;
        width:200px;
        height:25px;
        margin-bottom: 5px;
        background:#3bb4f200;
        border-radius: 5px;
        box-shadow:1px 1px 5px #666;
        display:inline-block;
        text-decoration: none;
    }
    .selector:hover{         /*添加hover效果*/
        background:#b1b6b0;
    }
    .selector select{        /*以相同大小将<select></select>绝对定位*/
        top:0px;
        left:0px;
        position:absolute;
        width:200px;
        height:25px;
        opacity:0;
    }
    .selector select option[selected]{
        font-weight:bold
    }
    .selector select option:nth-child(even) {
        background-color:#A7DAEF;
    }
    .selector select option{
        color:#EA5400;
    }
    .selector span{     /*显示内容*/
        position: absolute;
        top:3px;
        left:5px;
        right: 20px;
        display: inline-block;
        color:#fff;
        overflow:hidden;
        text-overflow: ellipsis;
        white-space:nowrap;
    }
    </style>
</head>

<body data-type="index">
    <header class="am-topbar am-topbar-inverse admin-header">
        <div class="am-topbar-brand">
            <a href="index.html" class="tpl-logo">
                <img src="assets/img/logo.png" alt="">
            </a>
        </div>
        <div class="am-icon-list tpl-header-nav-hover-ico am-fl am-margin-right">
        </div>
        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>
        <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
            <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
                <li class="am-dropdown">
                    <div style="margin-top: 20px">
                        <input type="text" id="text" style="width: 230px" placeholder="搜索课程" />
                        <a onclick="search_name()">
                            <i class="glyphicon-header cursor-header am-icon-search" id="search_bars"></i>
                        </a>
                    </div>
                </li>
                <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen" class="tpl-header-list-link"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
                <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                    <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                        <span class="tpl-header-list-user-nick">禁言小张</span><span class="tpl-header-list-user-ico"> <img src="assets/img/user01.png"></span>
                    </a>
                    <ul class="am-dropdown-content">
                        <li><a class="logout"><span class="am-icon-power-off"></span> 退出</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </header>
    <div class="tpl-page-container tpl-page-header-fixed">
        <div class="tpl-left-nav tpl-left-nav-hover">
            <div class="tpl-left-nav-title">
                用户中心
            </div>
            <div class="tpl-left-nav-list">
                <ul class="tpl-left-nav-menu">
                    <li class="tpl-left-nav-item">
                        <a href="chart.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-bar-chart"></i>
                            <span>课程信息</span>
                           <!--  <i class="tpl-left-nav-content tpl-badge-danger"></i> -->
                        </a>
                    </li>
                    <li class="tpl-left-nav-item">
                        <a href="recommend_course.html" class="nav-link active">
                            <i class="am-icon-bar-chart"></i>
                            <span>推荐课程</span>
                           <!--  <i class="tpl-left-nav-content tpl-badge-danger"></i> -->
                        </a>
                    </li>
                    <li class="tpl-left-nav-item">
                        <a href="statistics.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-bar-chart"></i>
                            <span>统计信息</span>
                            <!-- <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i> -->
                        </a>
                    </li>
                    <li class="tpl-left-nav-item">
                        <a href="userinfo.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-wpforms"></i>
                            <span>用户信息</span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="tpl-content-wrapper">
            <div class="tpl-content-page-title">
                课程信息系统
            </div>
            <ol class="am-breadcrumb">
                <li><a href="userinfo.html">推荐课程</a></li>
                <li class="am-active">为您推荐</li>
            </ol>
            <div class="select_num">
                <span style="font-size: 20px;color: #666">请选择推荐课程个数</span>
                <select class="selector" onchange="select()" id="select">
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6" selected="selected">6</option>
                </select>
            </div>
            <div class="tpl-portlet-components">
                <div class="am-g">
                    <div class="tpl-table-images1">
                        <div class="am-u-sm-12 am-u-md-6 am-u-lg-4">
                            <div class="tpl-table-images-content">
                                <div class="tpl-table-images-content-i-time">开始时间：<span>2016-09-12</span>&nbsp;&nbsp;持续时间：<span>7周</span></div>
                                <a href="javascript:;" class="tpl-table-images-content-i">
                                        <span class="tpl-table-images-content-i-shadow"></span>
                                        <img src="assets/img/a1.png" alt="">
                                    </a>
                                <div class="tpl-table-images-content-block">
                                    <div class="tpl-i-title">
                                        <a href="http://mooc.guokr.com/course/16/Machine-Learning/">机器学习（Machine Learning）</a>
                                    </div>
                                    <div class="tpl-i-con">
                                        <div class="sort">课程类别：<span>计算机</span></div>
                                        <div class="comment"><span>评价：</span><span class="ratyli" data-rate="3"></span><span style="color:#32c5d2;">9.7</span></div>
                                    </div>
                                    <div class="tpl-i-more-1">
                                        <ul>
                                            <li><span class="font-green">教师参与:8.8</span></li>
                                            <li><span class="font-green">设计量:9.8</span></li>
                                            <li><span class="font-green">知识量:9.8</span></li>
                                            <li><span class="font-green">兴趣度:9.8</span></li>
                                            <li><span class="font-green">难易度:简单</span></li>
                                        </ul>
                                    </div>
                                    <div class="tpl-i-more">
                                        <ul>
                                            <li><span class="am-text-warning">参评数： 100+</span></li>
                                            <li><span class="am-text-success">笔记数： 235+</span></li>
                                            <li><span class="font-green">点评数： 600+</span></li>
                                            <li><span class="am-text-warning">讨论数： 100+</span></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/amazeui.min.js"></script>
    <script src="assets/js/iscroll.js"></script>
    <script src="assets/js/app.js"></script>
    <script src="assets/js/raty/jquery.ratyli.min.js"></script>
    <script src="common/jquery.pagination.js"></script>
    <script src="./assets/js/logout.js"></script>
    <script>
    function select() {

        $.ajax({
            type: "get",
            url: "/author/userInfo",
            success: function(data) {
                console.log(data)
                $(".tpl-header-list-user-nick").html(data.data.authorName)
            }

        })

        $('.ratyli').ratyli({
            disable: true
        });

        var pageSize = $(".selector ").val();
        var message = {
            pageNumber: 1,
            pageSize: pageSize
        }
        $.ajax({
            type: "get",
            url: "/api/recommend",
            data: message,
            contentType: "application/json",
            success: function(result) {
                //console.log(data)
                var datalist = "";
                $.each(result.data, function(i, item) {
                    datalist +=
                        '<div class="am-u-sm-12 am-u-md-6 am-u-lg-4"><div class="tpl-table-images-content"><div class="tpl-table-images-content-i-time"><span>' +
                        item.startTime + '</span>&nbsp;&nbsp;<span>' + item.durationTime +
                        '</span></div> <a href="javascript:;" class="tpl-table-images-content-i"><span class="tpl-table-images-content-i-shadow"></span><img src="assets/img/a1.png" alt=""></a><div class="tpl-table-images-content-block"><div class="tpl-i-title"><a href="http://mooc.guokr.com/course/16/Machine-Learning/" >' +
                        item.courseNameCn + '（' + item.courseNameEn +
                        '）</a></div><div class="tpl-i-con"><div class="sort">课程类别：<span>' +
                        item.className +
                        '</span></div><div class="comment"><span>评价：</span><span class="ratyli" data-rate="' +
                        parseInt(item.star) +
                        '"></span><span style="color:#32c5d2;">' + item.score +
                        '</span></div></div><div class="tpl-i-more-1"><ul><li><span class="font-green">教师参与:' +
                        item.teacherV +
                        '</span></li><li><span class="font-green">设计量:' + item.designV +
                        '</span></li><li><span class="font-green">知识量:' + item.knowledgeV +
                        '</span></li><li><span class="font-green">兴趣度:' + item.interestV +
                        '</span></li><li><span class="font-green">难易度：' + item.courseLevel +
                        '</span></li>    </ul></div><div class="tpl-i-more"><ul><li><span class="am-text-warning">参评数： ' +
                        item.courseScorePeople +
                        '</span></li><li><span class="am-text-success">笔记数：' + item
                        .noteNum + '</span></li><li><span class="font-green">点评数： ' +
                        item.remarkNum +
                        '</span></li><li><span class="am-text-warning">讨论数： ' +
                        item.talkNum + '</span></li></ul></div></div></div></div>';

                })
                $(".tpl-table-images1").html(datalist);
            }

        })

    }
    var message = {
            pageNumber: 1,
            pageSize: 6
        }
        $.ajax({
            type: "get",
            url: "/api/recommend",
            data: message,
            contentType: "application/json",
            success: function(result) {
                //console.log(data)
                var datalist = "";
                $.each(result.data, function(i, item) {
                    datalist +=
                        '<div class="am-u-sm-12 am-u-md-6 am-u-lg-4"><div class="tpl-table-images-content"><div class="tpl-table-images-content-i-time"><span>' +
                        item.startTime + '</span>&nbsp;&nbsp;<span>' + item.durationTime +
                        '</span></div> <a href="javascript:;" class="tpl-table-images-content-i"><span class="tpl-table-images-content-i-shadow"></span><img src="assets/img/a1.png" alt=""></a><div class="tpl-table-images-content-block"><div class="tpl-i-title"><a href="http://mooc.guokr.com/course/16/Machine-Learning/" >' +
                        item.courseNameCn + '（' + item.courseNameEn +
                        '）</a></div><div class="tpl-i-con"><div class="sort">课程类别：<span>' +
                        item.className +
                        '</span></div><div class="comment"><span>评价：</span><span class="ratyli" data-rate="' +
                        parseInt(item.star) +
                        '"></span><span style="color:#32c5d2;">' + item.score +
                        '</span></div></div><div class="tpl-i-more-1"><ul><li><span class="font-green">教师参与:' +
                        item.teacherV +
                        '</span></li><li><span class="font-green">设计量:' + item.designV +
                        '</span></li><li><span class="font-green">知识量:' + item.knowledgeV +
                        '</span></li><li><span class="font-green">兴趣度:' + item.interestV +
                        '</span></li><li><span class="font-green">难易度：' + item.courseLevel +
                        '</span></li>    </ul></div><div class="tpl-i-more"><ul><li><span class="am-text-warning">参评数： ' +
                        item.courseScorePeople +
                        '</span></li><li><span class="am-text-success">笔记数：' + item
                        .noteNum + '</span></li><li><span class="font-green">点评数： ' +
                        item.remarkNum +
                        '</span></li><li><span class="am-text-warning">讨论数： ' +
                        item.talkNum + '</span></li></ul></div></div></div></div>';

                })
                $(".tpl-table-images1").html(datalist);
            }

    })

    function search_name() {
        var course_name = $("#text").val();
        document.cookie = "keyword_user=" + course_name;
        window.location.href = "/user/course_search.html?name=" + course_name;
    }
    </script>
</body>

</html>